import pandas as pd

bookdata=pd.read_csv('../dataset/book/book.csv')

def marge(bookdata):
    bookid=[]
    tagid=[]

    for i in range(len(bookdata)):
        item=bookdata.loc[i]
        tag=item[7].split('-')
        for j in tag:
            bookid.append(item[1])
            tagid.append(j)

    df=pd.DataFrame({'book_id':bookid,'tag_id':tagid})
    return df

if __name__ == '__main__':
    marge(bookdata).to_csv('../dataset/book/bookid_tagid.csv')